<?php

namespace app\models;

use Yii;
use yii\web\UploadedFile;

/**
 * This is the model class for table "activity_zan".
 *
 * @property integer $id
 * @property string $name
 * @property string $image
 * @property integer $count_1
 * @property integer $count_2
 * @property integer $count_3
 * @property string $gift_1
 * @property string $gift_2
 * @property string $gift_3
 * @property string $address
 * @property string $belong
 * @property string $created_at
 * @property string $updated_at
 * @property integer $created_by
 * @property integer $updated_by
 */
class ActivityZan extends BaseModel
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'activity_zan';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'file', 'count_1', 'gift_1', 'address', 'belong'], 'required'],
            [['count_1', 'count_2', 'count_3',  'created_by', 'updated_by'], 'integer'],
            [['created_at', 'updated_at'], 'safe'],
            [['name', 'gift_1', 'gift_2', 'gift_3'], 'string', 'max' => 16],
            [['image'], 'string', 'max' => 64],
            [['address'], 'string', 'max' => 32],
            [['file'], 'file', 'extensions' => 'jpg, png', 'mimeTypes' => 'image/jpeg, image/png',],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => '活动名',
            'image' => '店铺图片',
            'count_1' => '集赞数1',
            'count_2' => '集赞数2',
            'count_3' => '集赞数3',
            'gift_1' => '奖品1',
            'gift_2' => '奖品2',
            'gift_3' => '奖品3',
            'address' => '店铺地址',
            'belong' => '活动商家id',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
            'created_by' => '创建者',
            'updated_by' => '更新者',
        ];
    }

    public $file;

    public function beforeSave1($insert)
    {
        return parent::beforeSave($insert); // TODO: Change the autogenerated stub
    }
}
